package com.ming_za.odupdaterserver.core.sqlite.domain;

import java.io.Serial;
import java.io.Serializable;
import java.util.Arrays;
import lombok.Data;

/**
 * 
 * @TableName admin_account
 */
@Data
public class AdminAccount implements Serializable {
    /**
     * 
     */
    private Long account;

    /**
     * 
     */
    private String password;

    /**
     * 
     */
    private String lastIp;

    /**
     * 
     */
    private Long lastLogin;

    /**
     * 
     */
    private Long regTime;

    /**
     * 
     */
    private String regIp;

    /**
     * 
     */
    private Integer level;

    /**
     * 
     */
    private byte[] tokenKey;

    @Serial
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        AdminAccount other = (AdminAccount) that;
        return (this.getAccount() == null ? other.getAccount() == null : this.getAccount().equals(other.getAccount()))
            && (this.getPassword() == null ? other.getPassword() == null : this.getPassword().equals(other.getPassword()))
            && (this.getLastIp() == null ? other.getLastIp() == null : this.getLastIp().equals(other.getLastIp()))
            && (this.getLastLogin() == null ? other.getLastLogin() == null : this.getLastLogin().equals(other.getLastLogin()))
            && (this.getRegTime() == null ? other.getRegTime() == null : this.getRegTime().equals(other.getRegTime()))
            && (this.getRegIp() == null ? other.getRegIp() == null : this.getRegIp().equals(other.getRegIp()))
            && (this.getLevel() == null ? other.getLevel() == null : this.getLevel().equals(other.getLevel()))
            && (Arrays.equals(this.getTokenKey(), other.getTokenKey()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getAccount() == null) ? 0 : getAccount().hashCode());
        result = prime * result + ((getPassword() == null) ? 0 : getPassword().hashCode());
        result = prime * result + ((getLastIp() == null) ? 0 : getLastIp().hashCode());
        result = prime * result + ((getLastLogin() == null) ? 0 : getLastLogin().hashCode());
        result = prime * result + ((getRegTime() == null) ? 0 : getRegTime().hashCode());
        result = prime * result + ((getRegIp() == null) ? 0 : getRegIp().hashCode());
        result = prime * result + ((getLevel() == null) ? 0 : getLevel().hashCode());
        result = prime * result + (Arrays.hashCode(getTokenKey()));
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", account=").append(account);
        sb.append(", password=").append(password);
        sb.append(", lastIp=").append(lastIp);
        sb.append(", lastLogin=").append(lastLogin);
        sb.append(", regTime=").append(regTime);
        sb.append(", regIp=").append(regIp);
        sb.append(", level=").append(level);
        sb.append(", tokenKey=").append(tokenKey);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}